package cn.com.basespringboot.service.impl;

import cn.com.basespringboot.bean.User;
import cn.com.basespringboot.mapper.UserDao;
import cn.com.basespringboot.service.UserService;
import cn.com.basespringboot.vo.UserVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserServiceImpl  implements UserService {
    @Resource
    private UserDao userDao;

    @Override
    public UserVo addUser(User user) {
        int id = userDao.addUser(user);
        user.setId(id);
        return UserVo.returnUser(user);
    }

    @Override
    public UserVo getUserByName(String name) {
        UserVo user = userDao.getUserByName(name);
        return user;
    }
}
